class Bullet {
    constructor(game, speed) {
        this.game = game
        this.speed = speed
        this.setUp()
    }

    setUp() {
        this.name = 'bullet'
        this.image = GuaImage.new(this.game, 'bullet')
        this.w = this.image.w
        this.h = this.image.h
    }
    static new(game, speed) {
        var i = new this(game, speed)
        return i
    }

    draw() {
        this.game.drawImage(this.image)
    }

    update() {
        this.move()
        if (this.image.y < -(this.image.h)) {
            this.alive = false
        }
    }

    move() {
        this.image.y -= this.speed
        this.setPosition(this.image.x, this.image.y) 
    }

    setPosition(x, y) {
        this.image.setPosition(x, y)
    }

    // debug() {
    //     this.speed = config.bullet_speed
    // }
}